//
//  FenSiZhongXinTableViewController.m
//  1243
//
//  Created by 我的 on 16/4/7.
//  Copyright © 2016年 1243. All rights reserved.
//

#import "FenSiZhongXinTableViewController.h"
#import "MyDataTableViewController.h"
#import "BaseNavController.h"
#import "WoDeFenSiTuanTableViewController.h"
#import "MyBonusTableViewController.h"
#import "FansManagerTableViewController.h"
#import "CaiWuMingXiViewController.h"

@interface FenSiZhongXinTableViewController ()
@property (nonatomic, strong) NSArray *array;
@end

@implementation FenSiZhongXinTableViewController

- (NSArray *)array {
    
    if (!_array) {
        _array = @[@"我的积分",@"我的信息",@"财务明细",@"粉丝管理",@"我的粉丝团"];
    }
    return _array;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"粉丝中心";
    self.tableView.tableFooterView = [[UIView alloc] init];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Table view data source

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

    return self.array.count;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    
    if (!cell) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
    }
    
    cell.textLabel.text = self.array[indexPath.row];
    cell.imageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"fans_%ld", indexPath.row + 1 ]];
    
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    
    if(indexPath.row == 0) {
        MyBonusTableViewController *myBonus = [[MyBonusTableViewController alloc] initWithStyle:UITableViewStyleGrouped];
        [self.navigationController pushViewController:myBonus animated:YES];
    } else if (indexPath.row == 1) {
        MyDataTableViewController *data = [[MyDataTableViewController alloc] init];
        
        [self.navigationController pushViewController:data animated:YES];
    } else if (indexPath.row == 2) {
        [self.navigationController pushViewController:[[CaiWuMingXiViewController alloc] init] animated:YES];
    } else if (indexPath.row == 4) {
        WoDeFenSiTuanTableViewController *fenSiTuan = [[WoDeFenSiTuanTableViewController alloc] init];
        [self.navigationController pushViewController:fenSiTuan animated:YES];
    }else   if (indexPath.row == 3) {
        FansManagerTableViewController *fansi = [[FansManagerTableViewController alloc] init];
        [self.navigationController pushViewController:fansi animated:YES];
    }else {
        
    }
    
}

@end
